<html lang="en" xmlns:th="http://www.thymeleaf.org">
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta http-equiv="Access-Control-Allow-Origin" content="*">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="../../../../../static/struct/layuimini/lib/layui-v2.5.5/css/layui.css " media="all">
    <!--<script type="text/javascript" src="../../static/js/login/jquery.min.js"></script>-->
    <script src="../../../../../static/struct/layuimini/lib/jquery-3.4.1/jquery-3.4.1.min.js"></script>
    <script src="../../../../../static/js/generaljs/watermarkbycanvas.js" charset="UTF-8"></script>
    <link rel="stylesheet" href="../../../../../static/css/generalcss/layuitablecheckboxfix.css">
    <script src="../../../../../static/struct/layuimini/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>

</head>
<body onload="addWaterMarker()" style="margin: 10px 10px 10px 10px">

<br />
<div class="layui-form-item">
    <div class="layui-inline">
        <div class="layui-input-inline">
            <input type="text" id="taskIdName" placeholder="任务单号" lay-verify="required" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-inline">
            <button type="submit" class="layui-btn" id="searchTask" lay-submit lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索</button>
        </div>
    </div>
    <br/>
    <fieldset class="layui-elem-field">
        <legend>测试组领取样品</legend>
        <div class="layui-field-box">
            <div class="layui-form">
                <form class="layui-form" action="#" method="post" id="formid">
                    <div class="layui-inline">
                        <label class="layui-form-label">任务编号</label>
                        <div class="layui-input-inline">
                            <input type="text" name="taskidname" id="taskid" readonly autocomplete="off" class="layui-input"  >
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">任务名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="taskname" id="tasknameid" readonly autocomplete="off" class="layui-input"  >
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">样品信息</label>
                        <div class="layui-input-inline">
                            <input type="text" name="sampleinfo" id="sampleinfoid" readonly autocomplete="off" class="layui-input"  >
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">样品库存</label>
                        <div class="layui-input-inline">
                            <input type="text" name="samplenum" id="samplenumid" readonly autocomplete="off" class="layui-input"  >
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">测试组</label>
                        <div class="layui-input-inline">
                            <input type="text" name="labname" id="labid" readonly autocomplete="off" class="layui-input"  >
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">领取人</label>
                        <div class="layui-input-inline">
                            <input type="text" name="testor" id="testorid" readonly autocomplete="off" class="layui-input"  >
                        </div>
                    </div>
                    <div class="layui-inline">
                        <label class="layui-form-label">操作人</label>
                        <div class="layui-input-inline">
                            <input type="text" name="samplemanager" id="samplemanagerid" readonly autocomplete="off" class="layui-input"  >
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </fieldset>
    <br />
    <button type="button" name="comfirmname" id="confirmid" class="layui-btn layui-btn-lg">确认领取</button>
</div>

</body>
<script src="../../../../static/struct/layuimini/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'table','layer'], function () {


        $(document).ready(function () {
            $("#taskIdName").focus();
        });

        $(document).keypress(function (e) {
            // 回车键事件
            if (e.which == 13) {
                clickSearch();
            }
        });


        $("#searchTask").click(function () {
            clickSearch();
        });


        function clickSearch(){
            /**
             * 获取input中的任务单号，精确匹配
             * 填充各字段
             */

            let inputTaskId = $("#taskIdName").val();

            if (inputTaskId.replace(/(^\s*)|(\s*$)/g, "") == ""){
                parent.layer.msg("未录入任务单号");
                $("#taskIdName").focus();
                return;
            }

            let data = '{"taskid":"' + inputTaskId + '"}';
            let loading = parent.layer.load(2);
            $.ajax({
                url : "/limsaction/getTaskInfoForGroupReceive",
                //data : JSON.stringify(data),
                data : data,
                type : "post",
                contentType:"application/json",
                dataType:"json",
                success:function(res){
                    //若成功，向各字段填入信息
                    parent.layer.close(loading);
                    parent.layer.msg(res.msg);
                },
                error:function(e){
                    parent.layer.close(loading);
                    parent.layer.msg("网络错误，请稍候再试");
                }
            });

        }


    });


</script>
</html>